package trading.util;

import java.util.ArrayList;
import java.util.List;

/**
 * Giving the original size of the order, return a list of smaller sizes that
 * the order should be split into.
 * 
 * @author ningt
 * 
 */
public class OrderSplitHelper {

    public List<Integer> splitStkShortSellingOrder(int originalSize) {
        List<Integer> splitSizes = new ArrayList<Integer>();
        int unProcessedSize = originalSize;
        while (unProcessedSize > 300) {
            splitSizes.add(200);
            unProcessedSize -= 200;
        }
        splitSizes.add(unProcessedSize);
        return splitSizes;
    }
    
    public List<Integer> splitStkBuyOrder(int originalSize) {
        List<Integer> splitSizes = new ArrayList<Integer>();
        int unProcessedSize = originalSize;
        while (unProcessedSize > 300) {
            splitSizes.add(200);
            unProcessedSize -= 200;
        }
        splitSizes.add(unProcessedSize);
        return splitSizes;
    }
}
